<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible"content="IE=8"><!--以IE8模式渲染-->
    <meta http-equiv="X-UA-Compatible"content="IE=7"><!--以IE7模式渲染-->
    <meta http-equiv="X-UA-Compatible"content="IE=9; IE=8; IE=7; IE=EDGE">
    <title>分期备注新增</title>
    <link rel="stylesheet" type="text/css" href="__PUBLIC__/easyui/themes/default/easyui.css">
    <link rel="stylesheet" type="text/css" href="__PUBLIC__/easyui/themes/icon.css">
    <link rel="stylesheet" type="text/css" href="__PUBLIC__/easyui/demo.css">
    <script type="text/javascript" src="__PUBLIC__/easyui/jquery.min.js"></script>
    <script type="text/javascript" src="__PUBLIC__/easyui/jquery.easyui.min.js"></script>
    <link rel="stylesheet" type="text/css" href="__PUBLIC__/js/jquery.alert.v1.2/jquery.alert.css"/>
    <link rel="stylesheet" type="text/css" href="__PUBLIC__/js/jquery_validate/css/validationEngine.jquery.css" >
    <link rel="stylesheet" type="text/css" href="__PUBLIC__/css/form_table.css">
    <script type="text/javascript" src="__PUBLIC__/js/jquery_validate/js/jquery.validationEngine.js"></script>
    <script type="text/javascript" src="__PUBLIC__/js/jquery_validate/js/jquery.validationEngine-zh_CN.js"></script>
    <script type="text/javascript" src="__PUBLIC__/js/common.js?a=1"></script>
    <script type="text/javascript" src="__PUBLIC__/js/ajax.js"></script>
    <script type="text/javascript" src="__PUBLIC__/js/vue/dist/vue.js"></script>
    <script type="text/javascript" src="__PUBLIC__/js/vue/dist_resource/vue-resource.js"></script>
</head>

<body>
<div id="tt">
    <div title="基本信息">
        <div style="width:98%" class="form-panel">
            <div  id="form-link">
                <div class="easyui-panel" style="padding:5px;border-width: 0px;border-bottom-width: 1px;">
                    <a href="javscript:;" class="easyui-linkbutton" @click="add_borrow_remark();" iconCls="icon-save" plain="true" style="width:80px">保存</a>
                    <a href="javscript:;" class="easyui-linkbutton" @click="reset();" iconCls="icon-reload" plain="true" style="width:80px">重置</a>
                    <a href="javscript:;" class="easyui-linkbutton" @click="close_tab();" iconCls="icon-undo" plain="true" style="width:80px">关闭</a>
                </div>
            </div>
            <div class="table_main">
                <form action="" id="defaultForm" method="post">
                    <table width="100%" border="0" cellpadding="8" cellspacing="0" class="tableBasic">
                        <tr>
                            <th width="131">名称</th>
                            <th>内容</th>
                        </tr>
                        <tr>
                            <td width="131">操作人员：</td>
                            <td>
                                <select v-model="remark_user" class="validate[required]">
                                    <option value="">请选择</option>
                                    <option v-for="remark_user in remark_user_array" v-bind:value="remark_user.user_id">{{remark_user.user_name}}</option>
                                </select>
                            </td>
                        </tr>
                        </tr>
                        <tr>
                            <td width="131">备注内容:</td>
                            <td>
                                <textarea name="code" cols="83" rows="8" class="textArea validate[required]"  v-model="remark_content"/></textarea>
                            </td>
                        </tr>
                    </table>
                </form>
            </div>
        </div>
    </div>
</div>
<script type="text/javascript">
    $(document).ready(function() {
        $('#defaultForm').validationEngine();
    });
    Vue.http.options.emulateJSON = true;
    new Vue({
        el: '#tt',
        data: {
            remark_user:"",
            remark_user_array:JSON.parse('{$remark_user_array}'),
            borrow_id:'{$borrow_id}',
            remark_content:"",
            insert_borrow_remark_url:"insert_borrow_remark"
        },
        created: function() {

        },
        methods:{
            add_borrow_remark:function(){
                if(!$("#defaultForm").validationEngine("validate")){
                    return false;
                };
                var vm=this;
                vm.$http.post(vm.insert_borrow_remark_url,{borrow_id:vm.borrow_id,remark_user:vm.remark_user,remark_content:vm.remark_content}).then(function(res){
                    var state=res.data.state;
                    var message=res.data.message;
                    alert(message);
                    if(state==1){
                        vm.close_tab();
                    }else{
                        window.location.reload();
                    }
                },function(){
                    alert('新增备注失败');   //失败处理
                });
            },
            reset:function(){
                $("#defaultForm")[0].reset();
            },
            close_tab:function(){
                window.parent.removeTab("借款申请详情",'../../borrow/borrowapply/borrowapply_detail?borrow_id='+this.borrow_id);
            }
        }
    })
</script>
</body>
</html>